package io.renren.modules.area.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.area.entity.AreadetailEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.area.dao.AreaDao;
import io.renren.modules.area.entity.AreaEntity;
import io.renren.modules.area.service.AreaService;


@Service("areaService")
public class AreaServiceImpl extends ServiceImpl<AreaDao, AreaEntity> implements AreaService {

    @Autowired
    AreaDao areadao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<AreaEntity> page = this.page(
                new Query<AreaEntity>().getPage(params),
                new QueryWrapper<AreaEntity>().like("area_id", params.get("key"))
        );

        return new PageUtils(page);
    }

    @Override
    public void listAreaDetail(String areaId, Page<AreadetailEntity> page) {
        areadao.listAreaDetail(areaId,page);
        System.out.println(areadao.listAreaDetail(areaId,page));
    }

}